/**
 * Created by JetBrains WebStorm.
 * User: liucw
 * Date: 13-2-27
 * Time: 下午8:53
 * To change this template use File | Settings | File Templates.
 */
function emitNews(){
    console.log('server - emit - news ');
    return {msg:'hello world'};
};

function onDisconnect(socket){
    var _fun = function(){
//        console.log('on disconnect :'+ typeof socket);
        console.log('socket.id :' + socket.id + ' , disconnect');
    }
    return _fun;
};

function onChat(socket){
    var _fun = function(data){

        console.log(data.from+' say to '+data.to+':'+data.msg);
        socket.emit('news',data);
    };
    return _fun;

}

exports.emitNews = emitNews;
exports.onDisconnect = onDisconnect;
exports.onChat = onChat;